home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Hyper
/
Q-R
/
RPN Calculator.cpt
/
RPN Calculator
/
background_2751.txt
< prev
next >
Wrap
Text File
|
1988-09-16
|
3KB
|
112 lines
-- background: 2751 from stack: in
-- bmap block id: 2136
-- flags: 4000
-- background id: 0
-- name:
----- HyperTalk script -----
on pushup
delete first line of card field Regs
end pushup
on check
global flag
global invflg
if flag = 1 then
if line 4 of card field "Regs" <> "" then pushup
delete line 4 of card field "Regs"
end if
put 0 into flag
put 0 into invflg
end check
on funcdrop
global flag
put card field "Regs" into temp
put line 2 of temp into line 3 of temp
put line 1 of temp into line 2 of temp
put temp into card field "Regs"
put 1 into flag
end funcdrop
on arcsin
-- From "Software Manual for the Elementary Functions
-- by W. Cody and W. Waite (Prentice Hall, 1980)
global Result
global nform
global aflag
global error
set numberFormat to "0.000000000000000000000000"
put line 4 of card field "Regs" into x
put abs(x) into Y
if Y > .5 then
put 1 - aflag into i
if Y > 1 then
beep
put 1 into error
exit arcsin
end if
put (1-Y)/2 into g
put -2*sqrt(g) into Y
put R(g) * Y + Y into Result
else
put aflag into i
if Y < .000000001 then
put Y into Result
else
put Y*Y into g
put Y + Y * R(g) into Result
end if
end if
if aflag = 0 then
if i = 1 then
put .78539816339744830962 + Result + .78539816339744830962 into Result
end if
if x < 0 then
put -Result into Result
end if
else
if x < 0 then
if i = 0 then
put 1.57079632679489661923 + Result + 1.57079632679489661923 into Result
else
put .78539816339744830962 + Result + .78539816339744830962 into Result
end if
else
if i = 1 then
put .78539816339744830962 - Result + .78539816339744830962 into Result
else
put -Result into Result
end if
end if
end if
end arcsin
function R g
set numberFormat to "0.000000000000000000000000"
put ((((-0.69674573447350646411*g + 10.152522233806463645)*g -39.688862997504877339)*g + 57.208227877891731407)*g -27.368494524164255994)*g into P
put ((((g - 23.823859153670238830)*g + 150.95270841030604719)*g - 381.86303361750149284)*g + 417.14430248260412556)*g - 164.21096714498560795 into Q
return P/Q
end R
on doMenu task
if the userLevel = 5 then
pass doMenu
else
if task = "Print Report..." then pass doMenu
if task = "Compact Stack" then pass doMenu
if task = "Paste Button" then pass doMenu
if task = "Copy Button" then pass doMenu
if task = "Cut Text" then pass doMenu
if task = "Copy Text" then pass doMenu
if task = "Paste Text" then pass doMenu
end if
end doMenu
on idle
if the userLevel = 5 then exit idle
hide menuBar
end idle